---
title: "SQL-014: Retrieve legal code tables for person maintenance"
summary: Retrieve the legal code-table names configured for the person-maintenance window.
status: draft
owner: SAIF Documentation Pipeline
last_reviewed: 2026-08-21
library: SAIF.Application.Claim.Legal
reference_type: embedded
---

# SQL-014 Retrieve legal code tables for person maintenance

Retrieves `LEGAL_CODE_TABLE` rows filtered to the `PersonMaint` maintenance window, ordered by code, for the `LEGALVIEWCODESQL` code-table lookup used by the legal-person/firm maintenance UI.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-014 |
| **Operation type** | Read |
| **Execution method** | Inline SQL (`clsCodeCollection.GetCodeCollection`) |
| **Database** | Oracle |
| **Command type** | Text |
| **Business object** | N/A (Application layer) |
| **Criteria property** | N/A (Application layer) |
| **Lifecycle method** | N/A (Application layer) |
| **Application class** | `clsLegalPersonManager` |

## Parameters

No runtime parameters — this is a static code-table lookup constant (`LEGALVIEWCODESQL`), executed as-is via `clsCodeCollection.GetCodeCollection(DPI, LEGALVIEWCODESQL)`.

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [LEGAL_CODE_TABLE](../database-tables.md#legal_code_table) | SELECT | `TABLE_NAME`, `TABLE_MAINT_WIN_NAME` |

## Sample SQL

```sql
SELECT
  TABLE_NAME As code,
  TABLE_NAME As code_descr
FROM LEGAL_CODE_TABLE
WHERE TABLE_MAINT_WIN_NAME = 'PersonMaint'
ORDER BY code
```

## Business rules
- [BR-LGL-016: A legal person cannot be deleted while in use](../business-rules.md#br-lgl-016-a-legal-person-cannot-be-deleted-while-in-use)*

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts. Statements marked with `**` could not be confirmed; treat
> as unknown until verified.

## Sources
- `SAIF.Application.Claim.Legal\clsLegalPersonManager.vb`
